/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.dpy.appmvdpy.Controllers;

import com.dpy.appmvdpy.Facades.DefaultFacade;
import com.dpy.appmvdpy.Facades.FormaPagamentoFacade;
import com.dpy.appmvdpy.Models.FormaPagamento;
import com.dpy.appmvdpy.Models.Importers.FormaPagamentoImporter;
import com.dpy.appmvdpy.Models.Importers.Importer;
import com.dpy.appmvdpy.Models.Validators.DefaultValidator;
import com.dpy.appmvdpy.Models.Validators.FormaPagamentoValidator;
import java.io.File;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.support.SessionStatus;
import org.springframework.web.servlet.ModelAndView;

/**
 *
 * @author Lilli
 */
@Controller
@RequestMapping("/formaPagamento")
@Secured("ROLE_ADMIN")
public class FormaPagamentoController extends DefaultController<FormaPagamento> {
    
    public FormaPagamentoController()
    {
       super(FormaPagamento.class,"formaPagamento");    
    }    
    
    @Autowired
    private FormaPagamentoFacade facade;
    
    @Autowired
    private FormaPagamentoValidator validator;
    
    
    @Override
    public DefaultFacade<FormaPagamento> getFacade() {
       return this.facade;
    }

    @Override
    public FormaPagamento createObject() {
        return new FormaPagamento();
    }

    @Override
    public DefaultValidator<FormaPagamento> getValidator() {
        return this.validator;
    }

    @Override
    @Secured("ROLE_ADMIN")
    public ModelAndView create() {
        return super.create();
    }

    @Override
    @Secured("ROLE_ADMIN")
    public ModelAndView create(FormaPagamento model, BindingResult result, SessionStatus status) {
        return super.create(model, result, status);
    }

    @Override
    @Secured("ROLE_ADMIN")
    public ModelAndView delete(int id) {
        return super.delete(id);
    }

    @Override
    @Secured("ROLE_ADMIN")
    public ModelAndView detail(int id) {
        return super.detail(id);
    }

    @Override
    @Secured("ROLE_ADMIN")
    public ModelAndView edit(int id) {
        return super.edit(id);
    }

    @Override
    @Secured("ROLE_ADMIN")
    public ModelAndView search(String name) {
        return super.search(name);
    }
    
    @Override
    @Secured("ROLE_ADMIN")
    public ModelAndView Import() {
        return super.Import();
    }

    @Override
    public Importer<FormaPagamento> getImporter(File file) {
        return new FormaPagamentoImporter(file);                
    }  
    
}
